FROM python:3.10-slim
# 手动创建 /etc/apt/sources.list 并添加清华大学的镜像源
RUN  rm -rf /etc/apt/sources.list.d/* && echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free" > /etc/apt/sources.list && \
    echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free" >> /etc/apt/sources.list && \
    echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free" >> /etc/apt/sources.list \

# 安装依赖
RUN apt-get update && apt-get install -y git ca-certificates && rm -rf /var/lib/apt/lists/*

RUN  pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && pip install flask && \
     python -m pip install paddlepaddle==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/ && \
     git clone https://gitee.com/paddlepaddle/PaddleX.git && \
     cd PaddleX && \
     pip install -e . && \
     paddlex --install PaddleOCR PaddleDetection PaddleClas --platform gitee.com

# 设置工作目录
WORKDIR /app

# 复制代码到容器中
COPY ppx /app
# 暴露端口
EXPOSE 5000

# 启动应用
CMD ["python", "app.py"]